home *** CD-ROM | disk | FTP | other *** search
- Since working with the GUI Extension, and also on my Mailinglist software,
- ive been asked by several AMOS users how it is possible for the betatesters
- to send their information directly to me via the net (without saving it to
- YAM/UUSPOOL first). Included in this mail, is the source code for placing
- such a form in your own creations. Attached to this mail is a file named
- Mailform.WIN which you should simply load as a window in your GadToolsBox
- file, and save accordingly. You will also need to change the Gui Open/Close
- commands to react correctly with it. This program should work with Gui V1.62
- although I haven't tried.
-
- Feel free to use this program in your own productions, just give me and the
- PD library a mention in the documentation/in the program. If you have any
- comments/questions about this routine, feel free to email me or the list.
-
- ' Simple Mailform program. Written using the GUI Extension (V1.70)
- ' Written by Andy "Mushroom" Kellett C Mushroom PD 1998.
- '
- ' This program is freely usable by anybody.
- '
- ' Note, that you WILL have to change the GUI Open/Close commands to respond
- ' to that of the correct one in your program. You will also need to
- ' customize the program + SMTP servers to your own needs.
- '
-
- Dim LV$(200)
- Global LV$()
-
- Procedure EMAILREQUEST
- ' This part of the program asks for the user's information so that they
- can
- ' be contacted in the future about any new releases/updates or other info
- ' which can be sent to them. It also gives me an idea of just who is
- using
- ' the program, so you can determine which part of the world wishes to use
- it
- ' more.
-
- Proc COUNTRYS : Rem Read in the list of countrys to the large array
-
- Gui Open 2,10,20 : Rem Open up the GUI Screen
- Gui Set 2,4,1,Array(LV$(0)) : Gui Set 2,4,0,0 : Rem Setup array and First
- selection
-
- LP1:
- A=Gui Wait
-
- If A=0 : Rem SEND INFO button hit
- Goto _PROCESS
- End If
-
- Goto LP1
-
- _PROCESS:
- ' Check the status of the gadgets to make sure no abnormalities will be
- sent
- ' to my email box.
-
- NAME$=Gui Read$(2,1) : EM$=Gui Read$(2,2) : WWW$=Gui Read$(2,3) : CC$=Gui
- Read$(2,4)
-
- ' First check for blank headers
- If NAME$="" or EM$="" : Rem Blank Entry's
- A=Gui Req("Mail Error...","Blank Fields Remain in Entry","OK") : Goto
- LP1
- End If
-
- ' Now check that email contains the correct information
- I=Instr(EM$,"@")
- If I=0
- A=Gui Req("Mail Error...","Email address is incorrect. Please
- check.","OK") : Goto LP1
- End If
-
- ' I guess its safe to say that the email is pretty good to go once it
- gets here
- ' As well as the information given in the form, the program will send me
- ' the following pieces of information regarding the user:
- '
- ' There hostname ($HOSTNAME)
- ' There real name ($REALNAME)
- '
- ' This just gives me a brief idea of what will be going on with the
- program
-
- LP2:
- SERV$="mail.redrose.net" : Rem Change to your Mailserver
- HOST$="redrose.net" : Rem Change to your Host
- _TO$="mushypd@redrose.net" : Rem Change to your Email address
- FROM$=EM$
- EC$=Chr$(13)+Chr$(10)
-
- If Not Exist("Ram:Env/HOSTNAME")
- LP3:
- TEX$="It would appear that your Amiga is not"+Chr$(10)
- TEX$=TEX$+"connected to the internet. Please connect"+Chr$(10)
- TEX$=TEX$+"your machine to the internet, and hit the"+Chr$(10)
- TEX$=TEX$+"RETRY button to continue. If it is connected"+Chr$(10)
- TEX$=TEX$+"then please ensure the connection is OK."
-
- A=Gui Req("Connection Error...",TEX$,"Retry") : Goto LP2
- End If
-
- Trap A=Tcp Open(1,SERV$+"/25") : E=Errtrap : Tcp Limit 500
-
- ' IMPORTANT NOTE
- '
- ' Some SMTP mailservers do not use Port 21 (SMTP) but port 25. If your
- ' program doesnt work on the one port, then try the other (21). One way
- ' to test, is to connect to it with a Telnet program, as you should get
- ' a "ESMTP Server Ready" message if you connect correctly.
-
- If A=False or E>0
- A=Gui Req("Error.","Couldnt resolve SMTP Host","OK") : Goto LP3
- End If
-
- Open Out 2,"Sys:MailResults"
-
- A=Tcp Put$(1,"HELO "+HOST$+EC$)
- A=Tcp Put$(1,"MAIL FROM: <"+FROM$+">"+EC$)
- A=Tcp Put$(1,"RCPT TO: <"+_TO$+">"+EC$)
- A=Tcp Put$(1,"DATA"+EC$)
- A=Tcp Put$(1,"To: <"+_TO$+">"+EC$) :
- A=Tcp Put$(1,"From: My Program <"+FROM$+">"+EC$)
- A=Tcp Put$(1,"Subject: Internal Program Email"+EC$)
- A=Tcp Put$(1,"X-Comment: AMOSPro Test"+EC$)
- A=Tcp Put$(1,"X-Mailer: AMOSPro"+EC$+EC$)
-
- ' Now, another list of stuff to send. Ive put into data statements to
- ' limit the amount of repetitive code used.
-
- TEX$="hostname" : V=1 : Gosub _GETFILE
- Inc V : TEX$="realname" : Gosub _GETFILE
-
- D1:
- Data "Name: "+NAME$,"Email Address: "+EM$,"WWW: "+WWW$,"Country: "+CC$,"
- "
- Data "This Mailform was sent from My Program. The version of the"
- Data "program reported itself as being:"," ",VER$," "
- Data "This particular version of the program is unregistered, and was
- released"
- Data "into the public on March 5, 1998."," "
- Data "Hostname: "+HN$,"Real Name: "+RN$
- Data "*"
-
- Restore D1
- Repeat
- Read G$ : Rem Read in mail input
- If G$<>"*"
- A=Tcp Put$(1,G$+EC$) : Print #2,G$+Chr$(10);
- End If
- Until G$="*"
-
- A=Tcp Put$(1,"."+EC$)
- A=Tcp Put$(1,"QUIT"+EC$)
-
- Gui Pause 50
- Tcp Close 1 : Close 2
-
- TEX$="Your information has been emailed directly"+Chr$(10)
- TEX$=TEX$+"to the author, and you will be placed on the"+Chr$(10)
- TEX$=TEX$+"list of betatesters, and will also receive info"+Chr$(10)
- TEX$=TEX$+"on new updates etc. A copy of the information"+Chr$(10)
- TEX$=TEX$+"sent can be found in SYS:MailResults"+Chr$(10)+Chr$(10)
- TEX$=TEX$+"Thank-you"
-
- A=Gui Req("Mail Notification",TEX$,"No Problem!")
- A=Gui Close(2) : Gui On 1
- Pop Proc
-
- End
-
- _GETFILE:
- P$=""
- If Exist("RAM:ENV/"+TEX$) : Rem Enviroment File
- Open In 1,"Ram:Env/"+TEX$ : P$=Input$(1,Lof(1)) : Close 1
- End If
-
- If V=1 : HN$=P$ : End If
- If V=2 : RN$=P$ : End If
- Return
-
- _ERROR:
- TEX$="An error has occured. Please check the"+Chr$(10)+"connection you
- have to the internet"
- TEX$=TEX$+Chr$(10)+"and hit the RETRY button. If you want
- to"+Chr$(10)+"abort this operation for the moment"
- TEX$=TEX$+Chr$(10)+"then hit the CANCEL button."
-
- A=Gui Req("Processing Error...",TEX$,"Retry|Cancel")
-
- ' 1 = Retry
- ' 0 = Cancel
-
- If A=1 : Goto LP2 : End If
- If A=0 : Trap Kill "MLM:Data/MailResults" : A=Gui Close(2) : Gui On 1 :
- Pop Proc : End If
- End Proc
-
- Procedure COUNTRYS
- CT:
- Data "Afghanistan","Albania","Algeria","Andorra","Angola","Antigua and
- Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan"
- Data "Bahamas,
- The","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia
- and Herzegovina"
- Data "Botswana","Brazil","Brunei","Bulgaria","Burkina
- Faso","Burma","Burundi","Cambodia","Cameroon","Canada","Cape Verde"
- Data "Central African
- Republic","Chad","Chile","China","Colombia","Comoros","Congo
- (Brazzaville)","Congo (Kinshasa)","Costa Rica","Cote d'Ivoire","Croatia"
- Data "Cuba","Cyprus","Czech Republic","Denmark","Djibouti
- ","Dominica","Dominican Republic","Ecuador","Egypt","El
- Salvador","Equatorial Guinea"
- Data
- "Eritrea","Estonia","Ethiopia","Fiji","Finland","France","Gabon","Gambia,
- The","Georgia","Germany","Ghana"
- Data
- "Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India"
- Data
- "Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya"
- Data "Kiribati","Korea, North","Korea,
- South","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya"
- Data "Liechtenstein","Lithuania","Luxembourg","Macedonia, The Former
- Yugoslav Republic
- of","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall
- Islands"
- Data "Mauritania","Mauritius","Mexico","Micronesia, Federated States
- of","Moldova","Monaco","Mongolia","Morocco","Mozambique","Namibia","Nauru"
- Data "Nepal","Netherlands","New
- Zealand","Nicaragua","Niger","Nigeria","Norway","Oman","Pakistan","Palau","Panama"
- Data "Papua New
- Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russia","Rwanda","Saint
- Kitts and Nevis"
- Data "Saint Lucia","Saint Vincent and the Grenadines","Samoa","San
- Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia and
- Montenegro","Seychelles","Sierra Leone","Singapore"
- Data "Slovakia","Slovenia","Solomon Islands","Somalia","South
- Africa","Spain","Sri Lanka","Sudan","Suriname","Swaziland","Sweden"
- Data
- "Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tonga","Trinidad
- and Tobago","Tunisia","Turkey"
- Data "Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab
- Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vatican
- City","Vanuatu"
- Data "Venezuela","Vietnam","Yemen","Zambia","Zimbabwe",""
-
- Restore CT
- L=0
- Repeat
- Read LV$(L) : Inc L
- Until LV$(L-1)=""
- End Proc
-
- --
- Email: Andy Kellett <mushypd@redrose.net> Team *AMOS* + IAPA Team *AMIGA*
- *alt.religion.amos* - AMOS now on usenet! AMOS Mailinglist also mirrored
-
- * Proud Member of the AMOSPro V3 Development Team & Official AMOS Library *
-
- World's Largest AMOS Homepages - http://www.mushy-pd.demon.co.uk
-
- Also official US distributor of F1 Software. Quality Amiga titles at
- quality prices. See homepage for links.
-
-